package com.ithema.b2b.goodsconsumer.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

@Component
public interface InventoryService {
    int getInventoryByGoodsId(int goodsId);

    /**
     * 扣减库存
     * @param uid
     * @param goodsId
     * @param number
     * @return
     */
    int consumeInventory(int uid, int goodsId, int number);

    /**
     * 预扣减库存（二阶段提交）
     * @param uid
     * @param goodsId
     * @param number
     * @return
     */
    int preConsumeInventory(int uid, int goodsId, int number);

    /**
     * 提交扣减库存（二阶段提交）
     * @param uid
     * @param goodsId
     * @param number
     * @return
     */
    int commitConsumeInventory(int uid, int goodsId, int number);
}
